package cn.shyouchi.wuguanjia.android.ui.patrol.report;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.Button;

import com.chad.library.adapter.base.entity.MultiItemEntity;

import org.greenrobot.eventbus.EventBus;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import cn.shyouchi.wuguanjia.android.R;
import cn.shyouchi.wuguanjia.android.base.BaseActivity;
import cn.shyouchi.wuguanjia.android.event.SelLeaderEvent;
import cn.shyouchi.wuguanjia.android.widget.TopBar;

public class PatrolSelRepairLeaderActivity extends BaseActivity {

    @BindView(R.id.topBar)
    TopBar mTopBar;
    @BindView(R.id.rv_leader)
    RecyclerView mRvLeader;

    SelRepairLeaderAdapter mLeaderAdapter;

    List<MultiItemEntity> mLeaderGroups = new ArrayList<>();
    @BindView(R.id.btn_save)
    Button mBtnSave;


    @Override
    public int initContentView() {
        return R.layout.activity_patrol_sel_repair_leader;
    }

    @Override
    public void initInjector() {

    }

    @Override
    public void initUiAndListener() {
        ButterKnife.bind(this);
        mTopBar.setTitle(getTitle().toString());
        mTopBar.setLeftIcon(R.mipmap.ic_back);
        setSupportActionBar(mTopBar.getToolbar());

        RepairLeaderGroup group1 = new RepairLeaderGroup("物管管理人员");

        group1.addSubItem(new RepairLeaderSubitem("物管人员"));
        group1.addSubItem(new RepairLeaderSubitem("物管人员"));
        group1.addSubItem(new RepairLeaderSubitem("物管人员"));
        group1.addSubItem(new RepairLeaderSubitem("物管人员"));
        group1.addSubItem(new RepairLeaderSubitem("物管人员"));
        group1.addSubItem(new RepairLeaderSubitem("物管人员"));
        group1.addSubItem(new RepairLeaderSubitem("物管人员"));
        group1.addSubItem(new RepairLeaderSubitem("物管人员"));


        RepairLeaderGroup group2 = new RepairLeaderGroup("公司本部管理人员");
        group2.addSubItem(new RepairLeaderSubitem("公司本部人员"));
        group2.addSubItem(new RepairLeaderSubitem("公司本部人员"));
        group2.addSubItem(new RepairLeaderSubitem("公司本部人员"));
        group2.addSubItem(new RepairLeaderSubitem("公司本部人员"));
        group2.addSubItem(new RepairLeaderSubitem("公司本部人员"));
        group2.addSubItem(new RepairLeaderSubitem("公司本部人员"));
        group2.addSubItem(new RepairLeaderSubitem("公司本部人员"));
        group2.addSubItem(new RepairLeaderSubitem("公司本部人员"));

        mLeaderGroups.add(group1);
        mLeaderGroups.add(group2);

        mLeaderAdapter = new SelRepairLeaderAdapter(mLeaderGroups);
        mRvLeader.setAdapter(mLeaderAdapter);
        mRvLeader.setLayoutManager(new LinearLayoutManager(mContext));


    }

    @Override
    protected boolean isApplyStatusBarTranslucency() {
        return false;
    }

    @Override
    protected boolean isApplyStatusBarColor() {
        return true;
    }


    @OnClick(R.id.btn_save)
    public void onClick() {
        EventBus.getDefault().post(new SelLeaderEvent(mLeaderAdapter.getSelLeaderList()));
        finish();
    }
}
